package org.flow.basic.date;

import java.time.DayOfWeek;
import java.time.LocalDate;

/**
 * @author xl-9527
 * @since 2025/3/3
 **/
public class LocalDateDemo {

    public void dayOfMonth() {
        System.out.println(LocalDate.now().withDayOfMonth(1));
    }

    public void lastDayOfMonth() {
        LocalDate now = LocalDate.now();
        System.out.println(now.withDayOfMonth(now.lengthOfMonth()));
    }

    public void dayOfYear() {
        System.out.println(LocalDate.now().withDayOfYear(1));
    }

    public void lastDayOfYear() {
        LocalDate now = LocalDate.now();
        System.out.println(now.withDayOfYear(now.lengthOfYear()));
    }

    public void dayOfWeek() {
        System.out.println(LocalDate.now().with(DayOfWeek.MONDAY));
    }

    public void lastDayOfWeek() {
        System.out.println(LocalDate.now().with(DayOfWeek.SUNDAY));
    }
}
